package edu.upc.clase.demo.dao.impl;

import edu.upc.clase.demo.dao.HoraDao;
import edu.upc.clase.demo.entity.Hora;
import java.util.List;
import javax.sql.DataSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.simple.SimpleJdbcDaoSupport;
import org.springframework.stereotype.Repository;

/**
 *
 * SIX-GROUP-UPC
 */
@Repository
public class HoraDaoImpl extends SimpleJdbcDaoSupport implements HoraDao {
    
        
    private static Logger log = LoggerFactory.getLogger(UbigeoDaoImpl.class);
    
    @Autowired
    public HoraDaoImpl(DataSource dataSource) {
            log.info("Asignando el dataSource");
            setDataSource(dataSource);
    }
    

    @Override
    public List<Hora> buscarTodos() {
        return getSimpleJdbcTemplate().query(
                        "select CodigoHoras,DescripcionHoras,flagActivo from horas",
                        new BeanPropertyRowMapper<Hora>(Hora.class));
    }



   
}